import request from '@/utils/request'
// -------------搜搜------------

//查询热门标签  /doc/overall/getHotLabel
export const getHotLabelApi = (params) =>{
    return request({
        url:'/doc/overall/getHotLabel',
        method:'get',
        params
    })
}

//首页查询 /doc/overall/search
export const getOverallSearchApi=(params)=>{
    return request({
        url:"/doc/overall/search",
        method:'get',
        params
    })
}

//获取解答的数据列表  /doc/overall/qaList
export const getOverallQaListApi = (params) =>{
    return request({
        url:'/doc/overall/qaList',
        method:'get',
        params
    })
}

//获取法条的文章列表 /doc/overall/lawList
export const getOverallLawListApi = (params) =>{
    return request({
        url:'/doc/overall/lawList',
        method:'get',
        params
    })
}

//点击数的接口  /doc/top/click
// 1law法律  2qa问答  3policy政策  4contract合同
export const addDocTopClickApi = (id,type) =>{
    if(type=='1'){
        return request({
            url:`/doc/law/click?id=${id}`,
            method:'put',
        })
    }else if(type=='2'){
        return request({
            url:`/doc/qa/click?id=${id}`,
            method:'put',
        })
    }else if(type=='3'){
        return request({
            url:`/doc/policy/click?id=${id}`,
            method:'put',
        })
    }else if(type=='4'){
        return request({
            url:`/doc/contract/click?id=${id}`,
            method:'put',
        })
    }
}

//添加用户搜索记录  /service/userLabel/add
export const userLabelAddApi = (data) =>{
    return request({
        url:'/service/userLabel/add',
        method:'post',
        data
    })
}

//获取初始关键词列表数据
export const getLabelListApi = (size) =>{
    return request({
        url:`/doc/overall/getAllLabel?size=${size}`,
        method:'get',
    })
}

//获取初始关键词列表数据
export const getAllLabelListApi = () =>{
    return request({
        url:`https://wensanshi-dev.oss-cn-shenzhen.aliyuncs.com/labels/labels.json`,
        method:'get',
    })
}

// 添加文章浏览记录 /service/docHistory/add
export const addDocHistoryApi = (data) =>{
    return request({
        url:'/service/docHistory/add',
        method:'post',
        data
    })
}